package com.beep.erp.model.transfer;

import com.beep.erp.common.bean.TransferLogBean;
import com.beep.erp.http.HttpExceptionHandle;
import com.beep.erp.http.HttpResultSubscriber;

import rx.schedulers.Schedulers;

/**
 * Created by Jolly on 2018/9/2.
 */

public class TransferLogListPresenter extends TransferLogListContract.Presenter {
    @Override
    public void getTransferLogList(String sign, String timeStamp, int pageSize, int pageNo) {
        mView.showLoading();
        mRxManage.add(mModel.getTransferLogList(sign, timeStamp, pageSize, pageNo).unsubscribeOn(Schedulers.io()).subscribe(new HttpResultSubscriber<TransferLogBean>() {
            @Override
            public void onError(HttpExceptionHandle.ResponeThrowable e) {
                mView.hideLoading();
                mView.showMessage(e.ErrorInfo);
            }

            @Override
            public void onNext(TransferLogBean transferLogBean) {
                mView.hideLoading();
                mView.getTransferLogList(transferLogBean);
            }
        }));
    }

    @Override
    public void onStart() {
        mView.getDate();
    }

}
